home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earkit / mail / yam / rexx / exchangemailbox.rexx next >
OS/2 REXX Batch file  |  1999-01-01  |  2KB  |  113 lines

  1. /*
  2. ** $VER: ExchangeMailbox.rexx 1.1 (31.10.96)
  3. **
  4. ** Written by Marcin Orlowski <carlos@inet.com.pl>
  5. ** 
  6. ** This script launches Miami and YAM (if not launched),
  7. ** establishes Internet connection (if not established)
  8. ** then gets all new mails and sends all "Outgoing".
  9. **
  10. ** History:
  11. **
  12. ** v1.0  - initial release
  13. ** v1.1  - disconects Miami only when we had to
  14. **         establish connection, otherwise just
  15. **         quits.
  16. */
  17.  
  18. /*
  19. ** Some variables and pathes
  20. */
  21.  
  22. MIAMI      = "INET:Miami/Miami"
  23. MIAMI_FIND = 'WaitForPort MIAMI.1'
  24. YAM        = "YAM:YAM"
  25. YAM_FIND   = 'WaitForPort YAM'
  26.  
  27. /*
  28. ** Whenever we need to launch Miami or YAM we note
  29. ** this to quit only those app we launched
  30. */
  31.  
  32. YAM_CALL   = 0
  33. MIAMI_CALL = 0
  34.  
  35. /*
  36. ** Let's see if apps are running. If not, we call them
  37. ** Unfortunately command WaitForPort makes few tries
  38. ** before it return so it may take a while if apps are
  39. ** not running. You may use other tool instead.
  40. */
  41.  
  42. ADDRESS COMMAND MIAMI_FIND
  43. IF RC = 5 THEN
  44.   DO
  45.     MIAMI_CALL = 1
  46.     ADDRESS COMMAND "C:Run <>NIL: " || MIAMI
  47.   END
  48.  
  49. ADDRESS COMMAND YAM_FIND
  50. IF RC = 5 THEN
  51.   DO
  52.    YAM_CALL = 1
  53.    ADDRESS COMMAND "C:Run <>NIL: " || YAM
  54.   END
  55.  
  56. /*
  57. ** Small trick to wait until YAM finish its set up
  58. ** You may remove these lines if it takes longer
  59. ** for Miami to establish the connection than
  60. ** YAM to set up (don't forget: Amiga multitasks!)
  61. ** This depends on Miami setup (PULSE dialing,
  62. ** long number) and numer of mails in YAM folders
  63. ** especially if it needs to rebuild the index file
  64. */
  65.  
  66. ADDRESS YAM
  67. setfolder 0
  68.  
  69. /*
  70. ** Go online (if we are currently not)
  71. */
  72.  
  73. ADDRESS MIAMI.1
  74.  
  75. MAIMIONLINE = 0
  76. IsOnline
  77. IF RC = 0 THEN
  78.     DO
  79.      OnLine
  80.      MIAMIONLINE = 1
  81.     END
  82.  
  83. /*
  84. ** Let's exchange mailbox
  85. */
  86.  
  87. ADDRESS YAM
  88. mailcheck
  89. setfolder 1
  90. mailsendall
  91.  
  92. /*
  93. ** Let's clean up
  94. */
  95.  
  96. IF MIAMIONLINE THEN
  97.   DO
  98.     ADDRESS MIAMI.1
  99.     OffLine
  100.   END
  101.  
  102. IF MIAMI_CALL THEN
  103.   DO
  104.     ADDRESS MIAMI.1
  105.     Quit
  106.   END
  107.  
  108. IF YAM_CALL THEN
  109.   DO
  110.     ADDRESS YAM
  111.     Quit
  112.   END
  113.